﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Winforms = System.Windows.Forms;
using Majoopic.Engine;
using Majoopic.Service.Model;
using Majoopic.DataAccess.Model;
using Majoopic.Service;
using System.Threading.Tasks;
using System.Windows.Threading;
using System.Collections.ObjectModel;
using Majoopic.WPFClient.ViewModels;

namespace Majoopic.WPFClient.Views
{
    /// <summary>
    /// Interaction logic for UCEngineManager.xaml
    /// </summary>
    public partial class UCEngineManager : UserControl
    {
        private EngineManagerViewModel _VM;

        /// <summary>
        /// Constructor
        /// </summary>
        public UCEngineManager()
        {
            InitializeComponent();
            // Init the view model
            this._VM = Mediator.Current.EngineManagerViewModel;
            this.DataContext = this._VM;
        }

        private void tbRootFolder_GotFocus(object sender, RoutedEventArgs e)
        {
            // Use to lost the focus of the textbox to get it again if we click inside it
            this.cbWithCounter.Focus();
            // We convert the event GotFocus to the SelectFolderCommand
            if (this._VM.SelectFolderCommand.CanExecute(null))
            {
                this._VM.SelectFolderCommand.Execute(null);
            }
        }
    }
}
